﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class PlayerInWorld : MonoBehaviour
{
    public TeamData playerTeamData;
    public Team playerTeam;

    void Start()
    {
        ResetTeam();
    }

    void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.tag == "enemy")
        {
            TeamData enemyTeamData = collision.gameObject.GetComponent<EnemyInWorld>().teamData;
            EventSystem.StartFight(playerTeam, enemyTeamData);
        }
    } 

    void ResetTeam()
    {
        playerTeam = new Team(playerTeamData);
    }
}

